package com.tally.project.system.category.domain;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.tally.framework.web.BaseEntity;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

/**
 * 账单分类对象 category
 * @author soul
 * @date 2023-05-18
 */
public class Category extends BaseEntity
{
    private static final long serialVersionUID = 1L;

    /** 唯一ID */
    @JsonSerialize(using = ToStringSerializer.class)
    private Long id;

    /** 用户ID */
    @ApiParam(hidden = true)
    @JsonSerialize(using = ToStringSerializer.class)
    private Long userId;

    /** 账本ID */
    @ApiParam(name = "账本ID", value = "bookId")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long bookId;

    @ApiParam(name = "分类名称", value = "name")
    private String name;

    @ApiParam(name = "类型: 0.收入 1.支出", value = "type")
    private Integer type;

    @ApiParam(name = "图标", value = "icon")
    private String icon;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getUserId() {
        return userId;
    }

    public void setUserId(Long userId) {
        this.userId = userId;
    }

    public Long getBookId() {
        return bookId;
    }

    public void setBookId(Long bookId) {
        this.bookId = bookId;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getType() {
        return type;
    }

    public void setType(Integer type) {
        this.type = type;
    }

    public String getIcon() {
        return icon;
    }

    public void setIcon(String icon) {
        this.icon = icon;
    }

    public Category() {
    }

    public Category(Long id, Long userId, Long bookId, String name, Integer type, String icon) {
        this.id = id;
        this.userId = userId;
        this.bookId = bookId;
        this.name = name;
        this.type = type;
        this.icon = icon;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
            .append("id", getId())
            .append("userId", getUserId())
            .append("name", getName())
            .append("type", getType())
            .append("icon", getIcon())
            .append("createTime", getCreateTime())
            .append("updateTime", getUpdateTime())
            .toString();
    }
}
